package net.pulseproject.commons.midi.mediator;

import net.pulseproject.commons.midi.MessageAnalyzer;
import net.pulseproject.commons.midi.MidiDeviceCache;
import net.pulseproject.router.modules.misc.RoutingTable;

import com.google.inject.Inject;

public final class MediatorBuilderImpl implements MediatorBuilder {
	
	private final MidiReceiverBuilder receiverBuilder;
	
	private final MidiDeviceCache deviceCache;

	private final EnablerCollectionWrapper collectionWrapper;

	private final MessageAnalyzer messageAnalyzer;
	
	@Inject
	private MediatorBuilderImpl(final MidiReceiverBuilder receiverBuilder, final MidiDeviceCache deviceCache,
			final EnablerCollectionWrapper collectionWrapper, final MessageAnalyzer messageAnalyzer) {
		this.receiverBuilder = receiverBuilder;
		this.deviceCache = deviceCache;
		this.collectionWrapper = collectionWrapper;
		this.messageAnalyzer = messageAnalyzer;
	}
	
	public Mediator build(final RoutingTable table) {
		return new MediatorImpl(this.receiverBuilder, this.deviceCache, this.collectionWrapper, this.messageAnalyzer,
				table);
	}
	
}
